package com.lm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lm.dao.UserMapper;
import com.lm.model.User;
import com.lm.service.UserService;

/**
 * 10.创建UserServiceImpl类实现UserService接口:
 * @author Administrator
 *
 */
@Service
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserMapper userMapper;

	@Override
	public List<User> findAll() {
		
		return userMapper.findAll();
	}

	/**
	 * 根据用户名查询用户对象
	 */
	public User findUserByUserName(String username) {
		return userMapper.findUserByUserName(username);
	}

	/**
	 * 根据用户id删除用户
	 */
	public Integer removeUser(Integer id) {
		return userMapper.removeUser(id);
	}

	/**
	 * 根据用户id查询用户
	 */
	public User findUserById(Integer id) {
		return userMapper.findUserById(id);
	}

	/**
	 * 根据用户id修改用户信息
	 */
	public Integer updateUser(User user) {
		return userMapper.updateUser(user);
	}

	/**
	 * 新增用户 
	 */
	public Integer adduser(User user) {
		return userMapper.adduser(user);
	}
}
